package com.killer.controller;


import com.killer.service.ResumeFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author ：Killer
 * @date ：Created in 20-12-24 上午11:46
 * @description：${description}
 * @modified By：
 * @version: version
 */
@RestController
@RequestMapping("/autodeliver")
//允许手动向Client客户端发起POST请求,http://localhost:8092/actuator/refresh,刷新配置信息
//重要的是@RefreshScope 需要加在 @Value的类上面，并不是启动类上面
@RefreshScope
public class AutodeliverController {

    @Autowired
    private ResumeFeignClient resumeFeignClient;

    @Value("${killer.message}")
    private String message;

    @Value("${mysql.url}")
    private String url;

    @GetMapping("/checkStateFeign/{userId}")
    public Integer findResumeOpenStateFeign(@PathVariable Long userId) {
        Integer forObject = resumeFeignClient.findResumeOpenState(userId);
        System.out.println("======>>>调用简历微服务,获取到用户" +
                userId + "的默认简历当前状态为:" + forObject);
        return forObject;
    }

    @GetMapping("/getConfig")
    public String getConfig() {
        return message+"========"+url;
    }


}
